package com.bamboo.toolbox.core.swing;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;

/**
 * @author luzhiqing
 * @version 1.0
 * @date 2022/10/24
 */
public class OkDialog extends DialogWrapper {
    private final JPanel centerPanel;
    private final JTextField text;

    public OkDialog(@Nullable Project project, String textStr) {
        super(project);
        centerPanel = new JPanel();
        text = new JTextField(textStr);
        text.setEditable(false);
        text.setFont(new Font(null, Font.PLAIN, 20));
        text.setBorder(BorderFactory.createBevelBorder(5));
        centerPanel.add(text);
        centerPanel.setSize(300, 250);
        this.init();
        this.setAutoAdjustable(true);
    }

    @Override
    protected @Nullable JComponent createCenterPanel() {
        return centerPanel;
    }

    @Override
    public boolean isOK() {
        return super.isOK();
    }
}
